<html>
  <head>

  </head>
  <body>

    <input id="debounce" />

  </body>

  <script>

function ajax(content) {
  console.log('ajax request ' + content)
}

function debounce(fun, delay) {
  let timer = null;
  
    return function (...args) {
        let context = this;
        console.log('timer',timer)
        if(timer) clearTimeout(timer);
        timer = setTimeout(function() {
          fun.apply(context, args);
        }, delay);
        console.log('timer2',timer)
    }
}

fetch('https://p9s5xa.laf.run/handleFetch')
    
let inputb = document.getElementById('debounce')

let debounceAjax = debounce(ajax, 1000)

inputb.addEventListener('keyup', function (e) {
  
        debounceAjax(e.target.value)
    })

    setTimeout(() => {

      window.location.href ='http://127.0.0.1:5500/justdo/maopao.html'
      
    }, 4000);

  


  </script>


</html>